import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-plugin-persistedstate' // 数据持久化

// const namespace = `${import.meta.env.VITE_APP_NAMESPACE}-${appVersion}-${env}`

// const whiteNamespace = `${import.meta.env.VITE_APP_NAMESPACE}-${env}`
const store = createPinia()
store.use(
  createPersistedState({
    storage: {
      getItem: uni.getStorageSync,
      setItem: uni.setStorageSync,
    },
    // key: (storeKey) => {
    //   if (whitelist.includes(storeKey)) {
    //     return `${whiteNamespace}-${storeKey}`
    //   }
    //   return `${namespace}-${storeKey}`
    // },
  }),
)

export default store

// 模块统一导出
export * from './user'
export * from './access'
